const app = getApp()
// var WxParse = require('../../utils/wxParse/wxParse.js');
import WxParse from '../../utils/wxParse/wxParse.js'

Page({
  data: {
    article: {}
  },
  onLoad (options) {
    const self = this
    wx.showLoading({ title: "Loading..." })
    app.http({
      url: `https://gank.io/api/v2/post/${options.id}`
    }).then(res => {
      self.setData({
        article: res.data.data
      })
      console.log(res.data.data.markdown)
      console.log(res.data.data.content)

      if (res.data.data.markdown) {
        WxParse.wxParse(
          'article123',
          'md',
          res.data.data.markdown,
          self,
          5
        );
      } else {
        WxParse.wxParse(
          'article123',
          'html',
          res.data.data.content,
          self,
          5
        );
      }
    }).finally(() => {
      wx.hideLoading()
    })
  },
  wxParseTagATap(event) {
    console.log(event)
  }
});
